﻿using System.Data.SqlClient;
using Microsoft.SqlServer.Types;

namespace MyFloridaHouse.DataAccess.Extensions
{
	/// <summary>
	/// DistrictShapeGeography_DataContract
	/// </summary>
    public static class DistrictShapeGeography_DataContract
    {
		/// <summary>
		/// DataContract.
		/// </summary>
		/// <param name="rdr">The RDR.</param>
		/// <returns></returns>
        public static SqlGeography DataContract(SqlDataReader rdr)
        {

            // SQL Server 2008 CLR Types implementation 
            SqlGeography geog = (SqlGeography)rdr["mapGeog"];

            // SQL Server 2011 CLR Types implementation 
            //byte[] b = rdr.GetSqlBytes(rdr.GetOrdinal("mapGeom")).Buffer;
            //SqlGeometry geom = new SqlGeometry();
            //geom.Read(new BinaryReader(new MemoryStream(b)));

            return geog;
        }
    }
}